Array.prototype.myincludes = function(flag, value = 0) {
    if (value < 0) value = this.length + value
    const isNaN = Number.isNaN(flag)
    for(let i = value; i < this.length; i++) {
        if(this[i] == flag || (isNaN && Number.isNaN(this[i]))) {
            return true
        }
    }
    return false
}

let arr = [1,2,3,[1], NaN]
console.log(arr.myincludes(NaN));


console.log(arr.includes(NaN))